<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">


    <h:form>
        <h:commandButton action="login" value="Page1" />
    </h:form>
    <h:form id="treeForm">  
        <p:contextMenu for="tree" nodeType="collectionNode">  
            <p:menuitem value="View"  action="main" actionListener="#{lazyTableBean.generateTable()}" icon="ui-icon-search" />  
        </p:contextMenu>

        <p:contextMenu for="tree" nodeType="databaseNode">  
            <p:menuitem value="Statistics" action="properties" actionListener="#{mainController.showDatabaseStatistics()}" icon="ui-icon-search" />  
            <p:menuitem value="Drop" onclick="myConfirm.show();" icon="ui-icon-trash" />  
        </p:contextMenu>  
        
        <p:confirmDialog message="Are you sure?" header="Delete " severity="ui-icon-alert" global="true" widgetVar="myConfirm">  
            <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" actionListener="#{mainController.dropDatabase}"/>  
            <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>       
        </p:confirmDialog> 


        <p:tree  value="#{mainController.root}" var="node" dynamic="true" cache="false"  
                 selectionMode="single"  selection="#{mainController.selectedNode}" id="tree">  

            <p:ajax event="select" listener="#{mainController.onNodeSelect}" />   

            <p:treeNode type="databaseNode" icon="ui-icon-disk">  
                <h:outputText value="#{node}"/>  
            </p:treeNode>  

            <p:treeNode type="collectionNode" icon="ui-icon-note">  
                <h:outputText value="#{node}"/>  
            </p:treeNode>  
        </p:tree>  
    </h:form>  
</ui:composition> 